/*
 * @Author: WangZhiJie
 * @Date: 2024-03-26 13:52:53
 * @LastEditTime: 2024-04-01 14:30:54
 * @Description: 
 * @FilePath: \ga-smart-city-app-front\src\components\PageHeader\index.tsx
 */
import React from "react";
import "./index.less";
import { NavBar } from "antd-mobile";
import { useNavigate} from "react-router-dom";


type PageHeaderType = {
  leftBtn?:boolean;
  title: string;
  goBack?: () => void;
  rightBtn?:React.ReactNode|string
};
/**
 * 
 * @param leftBtn 左边按钮的显隐控制 
 * @param title 标题 
 * @param rightBtn 右边显示的内容 
 * @returns 
 */

const PageHeaderNew: React.FC<PageHeaderType> = ({ title,rightBtn,goBack }) => {
	const navigate = useNavigate();
  
  // const goBack = () => {
	// 	navigate(-1);
	// };
  return (
    <div className="header">
      <div className="header-center">
        <NavBar onBack={() => goBack()}>
          <div className="commontitle">{title}</div>
        </NavBar>
      </div>
        <div className="right_box">
          {rightBtn?rightBtn:<div></div>}
        </div>
    </div>
  );
};

export default PageHeaderNew;
